package main

import (
	"fmt"
	"math"
)

/*
	求平面直角坐标系内两个点的距离
*/

type Point struct {
	//x, y float64
	x float64
	y float64
}

//方法定义,(this Point)代表函数接收器，仅限Point类型对象调用
func (this Point) getDis(p Point) float64 {
	return math.Sqrt((this.x-p.x)*(this.x-p.x) + (this.y-p.y)*(this.y-p.y))
}

func main() {
	p1 := Point{0, 0}
	p2 := Point{3.0, 4.0}
	fmt.Println(p2.getDis(p1))
}
